
*libname TP_Data "The location of the data folder\TP_Pseudo";



/*Run this Macro to report Daniel, Grinblatt, Titman, and Wermers (1997) (DGTW) characteristic-adjusted mean returns and the Three- to Seven-factor model alphas*/

%MACRO DGTW_Ret_and_Alphas(Dataset=, DGTW_Ret_Var=, Ex_Ret_Var=);

Data Return_Data;
set &Dataset;
run;

proc means data= Return_Data mean stderr t prt ;
var  &DGTW_Ret_Var;
run;

proc reg data= Return_Data plots=none;
model &Ex_Ret_Var =MKTRF SMB HML;
run;

proc reg data= Return_Data plots=none;
model &Ex_Ret_Var =MKTRF SMB HML UMD;
run;

proc reg data= Return_Data plots=none;
model &Ex_Ret_Var =MKTRF SMB HML UMD PS_VWF;
run;

proc reg data= Return_Data plots=none;
model &Ex_Ret_Var =MKTRF SMB HML UMD PS_VWF ST_Rev;
run;

proc reg data= Return_Data plots=none;
model &Ex_Ret_Var =MKTRF SMB HML UMD PS_VWF ST_Rev LT_Rev;
run;

proc delete data= Return_Data ; run;

%mend DGTW_Ret_and_Alphas;




*** Table 5 ***;


** Panel A **;

%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_5_Panel_A, DGTW_Ret_Var=Strategy_1_DGTW_adj_ret, Ex_Ret_Var=Strategy_1_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_5_Panel_A, DGTW_Ret_Var=Strategy_2_DGTW_adj_ret, Ex_Ret_Var=Strategy_2_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_5_Panel_A, DGTW_Ret_Var=Strategy_3_DGTW_adj_ret, Ex_Ret_Var=Strategy_3_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_5_Panel_A, DGTW_Ret_Var=Strategy_4_DGTW_adj_ret, Ex_Ret_Var=Strategy_4_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_5_Panel_A, DGTW_Ret_Var=Strategy_5_DGTW_adj_ret, Ex_Ret_Var=Strategy_5_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_5_Panel_A, DGTW_Ret_Var=Strategy_6_DGTW_adj_ret, Ex_Ret_Var=Strategy_6_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_5_Panel_A, DGTW_Ret_Var=Strategy_7_DGTW_adj_ret, Ex_Ret_Var=Strategy_7_Ex_ret)


** Panel B **;

%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_5_Panel_B, DGTW_Ret_Var=TP_Diff_Strategy_1_DGTW_adj_ret, Ex_Ret_Var=TP_Diff_Strategy_1_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_5_Panel_B, DGTW_Ret_Var=TP_Diff_Strategy_2_DGTW_adj_ret, Ex_Ret_Var=TP_Diff_Strategy_2_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_5_Panel_B, DGTW_Ret_Var=TP_Diff_Strategy_3_DGTW_adj_ret, Ex_Ret_Var=TP_Diff_Strategy_3_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_5_Panel_B, DGTW_Ret_Var=TP_Diff_Strategy_4_DGTW_adj_ret, Ex_Ret_Var=TP_Diff_Strategy_4_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_5_Panel_B, DGTW_Ret_Var=TP_Diff_Strategy_5_DGTW_adj_ret, Ex_Ret_Var=TP_Diff_Strategy_5_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_5_Panel_B, DGTW_Ret_Var=TP_Diff_Strategy_6_DGTW_adj_ret, Ex_Ret_Var=TP_Diff_Strategy_6_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_5_Panel_B, DGTW_Ret_Var=TP_Diff_Strategy_7_DGTW_adj_ret, Ex_Ret_Var=TP_Diff_Strategy_7_Ex_ret)

